﻿@using Abp.Application.Services.Dto
@using FwProject.Roles.Dto
@using X.PagedList;
@using X.PagedList.Mvc.Core;
@using X.PagedList.Mvc.Common;
@model IPagedList<RoleOutputDto>
@{
    Layout = null;
}

<table class="table table-bordered table-hover table-rowselected">
    <thead>
        <tr>
            <th>角色名称</th>
            <th style="width:170px;">操作</th>
        </tr>
    </thead>
    <tbody>
        @if (Model.Count == 0)
        {
            <tr><td class="text-center" colspan="2">暂无角色</td></tr>
        }
        else
        {
            foreach (var position in Model)
            {
                <tr>
                    <td>@position.DisplayName</td>
                    <td>
                        <a class="btn btn-default btn-xs" href="javascript:top.window.openTab(501,'@(position.DisplayName + "-权限")','@Url.Action("Permission", new { id = position.Id })');"><i class="fa fa-key"></i>权限</a>
                        <button class="btn btn-success btn-xs" data-toggle="modal" data-target="#modal_ajax" data-backdrop="static" data-url="@Url.Action("Edit", new { id = position.Id })"><i class="fa fa-edit"></i>编辑</button>
                        <button class="btn btn-danger btn-xs" data-toggle="modal" data-target="#modal_del" data-url="@Url.Action("Delete", new { id = position.Id })"><i class="fa fa-times"></i>删除</button>
                    </td>
                </tr>
            }
        }
    </tbody>
</table>

<div class="row pagedinfo">
    <div class="col-sm-5">
        共 @Model.TotalItemCount 条，@Model.PageSize 条/页 当前 @Model.PageNumber/@Model.PageCount 页
    </div>
    <div class="col-sm-7">
        @Html.PagedListPager(Model, page => Url.Action("Index", new { id = page }), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new AjaxOptions() { AllowCache = false, HttpMethod = "Get", UpdateTargetId = "data_list", OnSuccess = "AjaxSuccessCallback", OnBegin = "AjaxBegin" }))
    </div>
</div>